﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using weikebuluo.DAL;
using weikebuluo.Model;
using weikebuluo.Common;

namespace weikeweixin.web.admin.website
{
    public partial class slide : weikeweixin.web.admin.cs.adminbase
    {

        t_home_dal homedal = new t_home_dal();
        t_home_model homemodel = new t_home_model();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(user_id)) {
                Response.Write("<script Language=\"Javascript\">alert(\"请先配置微官网\")");
                Response.Write("</script>");
                Response.End();
            }
            switch (Request.QueryString["action"])
            {
                case "bindhomead"://提交信息
                    GetHomeAd();
                    break;
                case "del":
                    DelHomeAd();
                    break;
            }

        }

        /// <summary>
        ///查询已添加的幻灯片
        /// </summary>
        public void GetHomeAd()
        {
            DataTable dtHomeAd = homedal.GetList("user_id ='" + user_id + "'").Tables[0];
            JsonOperate JsonOperate = new JsonOperate();
            Response.Write(JsonOperate.TableToBasicJson(dtHomeAd));
            Response.End();
        }

        /// <summary>
        /// 删除已选的幻灯片
        /// </summary>
        public void DelHomeAd() {
            bool bl = homedal.Delete(int.Parse(Request.QueryString["Id"].Trim()));
        }
    }
}